<?php
#include 'common.inc.php';
$mysqli = new mysqli('localhost', 'root', '', 'test_data');
$sql = 'select count(id), dianming from koubei_myisam2 group by dianming  having count(id)>1 order by count(id) desc limit 1;';
$result = $mysqli->query($sql);
$res = $result->fetch_assoc();
$sql = "select * from koubei_myisam2 where dianming = '{$res['dianming']}'";
$result = $mysqli->query($sql);
$res = $result->fetch_all(MYSQLI_ASSOC);
foreach ($res as $r) {
	$new = $r['dianming'].'_'.$r['chengshi'];
	//exit(print_r($r));
	$sql = "update koubei_myisam2 set dianming ='{$new}' WHERE ID = {$r['ID']}";
	$mysqli->query($sql);
}
echo '<meta http-equiv="refresh" content="0; url='.$_SERVER['PHP_SELF'].'" />';
echo '<pre style="font-size:300px;">';
echo count($res);
echo '</pre>';
echo $r['dianming'];
?>
